import 'package:dio/dio.dart';
import 'package:flutter_demo/core/service/auth_service.dart';

/**
 * 请求头添加 token
 */
class CookieInterceptors extends InterceptorsWrapper {
  @override
  void onRequest(RequestOptions options, RequestInterceptorHandler handler) {
    if (AuthService.to.isLoggedInValue && AuthService.to.cookie != null) {
      options.headers["token"] = AuthService.to.cookie;
    }
    super.onRequest(options, handler);
  }
}
